<!DOCTYPE html>
<html lang="en" onclick="console.log('html');">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        border: solid;
        padding: 10px;
        margin: 10px;
      }
    </style>
  </head>
  <body onclick="console.log('body');">
    <div id="box1" onclick="console.log(1);">
      box1
      <div id="box2" onclick="console.log(2);">
        box2
        <div id="box3" onclick="console.log(3);">
          box3
          <div id="box4" onclick="console.log(4);">box4</div>
        </div>
      </div>
    </div>
    <script>
      document.onclick = function(){
        console.log('document');
      }

      window.onclick = function(){
        console.log('window');
      }
    </script>
  </body>
</html>
